<?php


namespace App\Services;

/**
 * 后台缓存服务
*/
class AdminCacheService
{
    private $keys = [
        'initData', //系统首页初始化数据
        'indexConfig', //首页配置
        'wapIndexConfig', //手机端首页配置
        'UserMemberList_1', //user_member表1区缓存 仅[id,username]字段
        'UserRoleList_1', //user_role表1区缓存 仅[id,nick]字段

    ];

    private RedisService $redisService;

    public function __construct(RedisService $redisService)
    {
        $this->redisService = $redisService;
    }

    public function removeCache($key){
        $this->redisService->del($key);
    }
    public function removeAllCache(){
        foreach($this->keys as $key){
            $this->redisService->del($key);
        }
    }


}
